package bTree.LeetCode;

public class 两数相除 {
    public int divide(int dividend, int divisor) {
        int cnt = 0;
        if (dividend == 0) {
            return 0;
        }
        if (dividend < 0) {
            dividend = -dividend;
        }
        if (divisor < 0) {
            divisor = -divisor;
        }
        int sum = 0;
        while (sum<dividend){
            sum += divisor;
            cnt++;
        }
        if ( dividend * divisor > 0) {
            return cnt;
        }else {
            return -cnt;
        }

    }
}